﻿using System;

namespace RigLib
{
    class WinApiConsts
    {
        internal enum WindowMessages : uint
        {
            WM_NULL = 0x0000,
            WM_CREATE = 0x0001,
            WM_DESTROY = 0x0002,
            WM_ACTIVATE = 0x0006,
            WM_SETFOCUS = 0x0007,
            WM_ENABLE = 0x000A,
            WM_SETTEXT = 0x000C,
            /// <summary>
            ///   Copies the text that corresponds to a window into a buffer provided by the caller.
            /// </summary>
            WM_GETTEXT = 0x000D,
            WM_GETTEXTLENGTH = 0x000E,
            WM_CLOSE = 0x0010,
            WM_QUIT = 0x0012,
            WM_SHOWWINDOW = 0x0018,
        }

        /* Show Window Messages */

        /// <summary>
        ///   Controls how the window is to be shown. Used for ShowWindow calls
        /// </summary>
        internal enum ShowWindowCommands
        {
            /// <summary>
            ///   Hides the window and activates another window.
            /// </summary>
            SW_HIDE,
            /// <summary>
            ///   Activates and displays a window. If the window is minimized or maximized, the system restores it
            ///   to its original size and position.
            /// </summary>
            SW_SHOWNORMAL,
            /// <summary>
            ///   Activates the window and displays it as a minimized window.
            /// </summary>
            SW_SHOWMINIMIZED,
            /// <summary>
            ///   Activates the window and displays it as a maximized window.
            /// </summary>
            SW_SHOWMAXIMIZED,
            /// <summary>
            ///   Displays a window in its most recent size and position.
            ///   This value is similar to SW_SHOWNORMAL, except that the window is not activated.
            /// </summary>
            SW_SHOWNOACTIVATE,
            /// <summary>
            ///   Activates the window and displays it in its current size and position
            /// </summary>
            SW_SHOW,
            /// <summary>
            ///   Minimizes the specified window and activates the next top-level window in the Z order.
            /// </summary>
            SW_MINIMIZE,
            /// <summary>
            ///   Displays the window as a minimized window. 
            ///   This value is similar to SW_SHOWMINIMIZED, except the window is not activated
            /// </summary>
            SW_SHOWMINNOACTIVE,
            /// <summary>
            ///   Displays the window in its current size and position.
            ///   This value is similar to SW_SHOW, except that the window is not activated.
            /// </summary>
            SW_SHOWNA,
            /// <summary>
            ///   Activates and displays the window
            /// </summary>
            SW_RESTORE,
            /// <summary>
            ///   Sets the show state based on the SW_ value specified in the STARTUPINFO
            ///   structure passed to the CreateProcess function by the program that started the application.
            /// </summary>
            SW_SHOWDEFAULT,
            /// <summary>
            ///   Minimizes a window, even if the thread that owns the window is not responding.
            ///   This flag should only be used when minimizing windows from a different thread.
            /// </summary>
            SW_FORCEMINIMIZE
        }

        internal enum ListboxMessages
        {
            /* Multi-Select Only */
            /// <summary>
            ///   Selects an item in a multiple-selection list box and, if necessary, scrolls the item into view
            ///   wParam  Specifies how to set the selection. If this parameter is TRUE, the item is selected and highlighted; if it is FALSE, the highlight is removed and the item is no longer selected. 
            ///   lParam Specifies the zero-based index of the item to set. If this parameter is –1, the selection is added to or removed from all items, depending on the value of wParam, and no scrolling occurs. 
            ///   Return Value-If an error occurs, the return value is LB_ERR. 
            ///   Remarks-Use this message only with multiple-selection list boxes.
            /// </summary>
            LB_SETSEL = 0x0185,

            ///<summary>
            ///  Fills a buffer with an array of integers that specify the item numbers of selected items in a multiple-selection list box
            ///  wParam- The maximum number of selected items whose item numbers are to be placed in the buffer. 
            ///  lParam-A pointer to a buffer large enough for the number of integers specified by the wParam parameter. 
            ///  Return-The return value is the number of items placed in the buffer. If the list box is a single-selection list box, the return value is LB_ERR.
            ///</summary>
            LB_GETSELITEMS = 0x0191,

            /// <summary>
            ///   Gets the total number of selected items in a multiple-selection list box
            ///   wParam and lParam-Not used; must be zero. 
            ///   Return Value-The return value is the count of selected items in the list box. If the list box is a single-selection list box, the return value is LB_ERR.
            /// </summary>
            LB_GETSELCOUNT = 0x0190,


            /* Single Select Only */
            /// <summary>
            ///   Gets the index of the currently selected item, if any, in a single-selection list box
            ///   wParam and lParam Not used; must be zero. 
            ///   Return Value-In a single-selection list box, the return value is the zero-based index of the currently selected item. If there is no selection, the return value is LB_ERR.
            /// </summary>
            LB_GETCURSEL = 0x0188,

            /// <summary>
            ///   wParam The zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the wParam parameter. If wParam is –1, the entire list box is searched from the beginning. 
            ///   lParam A pointer to the null-terminated string that contains the prefix for which to search. The search is case independent
            ///   Return Value If the search is successful, the return value is the index of the selected item. If the search is unsuccessful,LB_ERR
            ///   Use this message only with single-selection list boxes. You cannot use it to set or remove a selection in a multiple-selection list box
            /// </summary>
            LB_SELECTSTRING = 0x018C,


            /* Either */
            ///<summary>
            ///  Selects a string and scrolls it into view, if necessary. When the new string is selected, the list box removes the highlight from the previously selected string. 
            ///  wParam Specifies the zero-based index of the string that is selected. If this parameter is -1, the list box is set to have no selection. 
            ///  lParam not used
            ///</summary>
            LB_SETCURSEL = 0x0186,

            ///<summary>
            ///  Finds the first string in a list box that begins with the specified string
            ///  wParam The zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues searching from the top of the list box back to the item specified by the wParam parameter. If wParam is –1, the entire list box is searched from the beginning. 
            ///  lParam A pointer to the null-terminated string that contains the string for which to search. The search is case independent, so this string can contain any combination of uppercase and lowercase letters. 
            ///  Return Value-The return value is the index of the matching item, or LB_ERR if the search was unsuccessful.
            ///</summary>
            LB_FINDSTRING = 0x018F,

            /// <summary>
            ///   Gets the number of items in a list box
            ///   wParam and lParam-zero
            ///   The return value is the number of items in the list box, or LB_ERR if an error occurs
            /// </summary>
            LB_GETCOUNT = 0x018B,

            ///<summary>
            ///  Gets the selection state of an item
            ///  wParam The zero-based index of the item
            ///  lParam This parameter is not used
            ///  Return Value-If an item is selected, the return value is greater than zero; otherwise, it is zero. If an error occurs, the return value is LB_ERR.
            ///</summary>
            LB_GETSEL = 0x0187,

            ///<summary>
            ///  Gets a string from a list box. 
            ///  wParam The zero-based index of the string to retrieve. 
            ///  lParam A pointer to the buffer that will receive the string; The buffer must have sufficient space for the string and a terminating null character.
            ///  Return Value length of the string, in TCHARs, excluding the terminating null character.
            ///</summary>
            LB_GETTEXT = 0x0189,

            /// <summary>
            ///   Removes all items from a list box
            /// </summary>
            LB_RESETCONTENT = 0x0184
        }

        [Flags]
        internal enum BST_ButtonStates
        {
            /// <summary>
            ///   No special state. Equivalent to zero.
            /// </summary>
            BST_UNCHECKED = 0x0000,
            /// <summary>
            ///   The button is checked.
            /// </summary>
            BST_CHECKED = 0x0001,
            /// <summary>
            ///   The state of the button is indeterminate. Applies only if the button has the BS_3STATE or BS_AUTO3STATE style.
            /// </summary>
            BST_INDETERMINATE = 0x0002,
            /// <summary>
            ///   The button is being shown in the pushed state.
            /// </summary>
            BST_PUSHED = 0x0004,
            /// <summary>
            ///   The button has the keyboard focus.
            /// </summary>
            BST_FOCUS = 0x0008,
            /// <summary>
            ///   Windows Vista. The button is in the drop-down state. Applies only if the button has the TBSTYLE_DROPDOWN style.
            /// </summary>
            BST_DROPDOWNPUSHED = 0x0400
        }


        /** Button Control Messages **/

        internal enum ButtonControlMessages
        {
            BM_GETCHECK = 0x00F0,
            /// <summary>
            ///   Sets the check state of a radio button or check box.
            /// </summary>
            BM_SETCHECK = 0x00F1,
            /// <summary>
            ///   Sends the button a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and sends the parent window a BN_CLICKED notification code.
            /// </summary>
            BM_CLICK = 0x00F5,
            /// <summary>
            ///   Returns the current check state, push state, and focus state of the button.
            /// </summary>
            BM_GETSTATE = 0x00F2,
            /// <summary>
            ///   Sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it.
            /// </summary>
            BM_SETSTATE = 0x00F3,
            /// <summary>
            ///   Retrieves a handle to the image (icon or bitmap) associated with the button.
            /// </summary>
            BM_GETIMAGE = 0x00F6
        }
    }


}
